import 'package:flutter/material.dart';

void main() {
  runApp(const MaterialApp(
    title: 'Status 2',
    home: HomePage(),
  ));
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  final List<String> _mylistData = [];

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: const Text('这是浮动按钮'),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          print('dianji');
          setState(() {
            _mylistData.add('我是一条数据');
          });
        },
        child: const Icon(Icons.add),
      ),
      body: ListView(
        children: _mylistData.map((value) {
          return ListTile(
            title: Text(value),
          );
        }).toList(),
      ),
    );
  }
}
